package com.jcal.librarymanager.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.jcal.librarymanager.R;
import com.jcal.librarymanager.fragments.FragmentListe;

public class Supprimer extends Dialog {

	public Supprimer(Context context, final int position) {
		super(context);
		
		setTitle(R.string.menu_action_ajouter);
		setContentView(R.layout.dialog_supprimer);
		
		TextView message = (TextView) findViewById(R.id.confirmerSuppression);
		Button oui = (Button) findViewById(R.id.oui);
		Button non = (Button) findViewById(R.id.non);
		
		oui.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
				FragmentListe.removeElement(position);
				FragmentListe.refresh();
				dismiss();
			}
		});
		
		non.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				dismiss();
			}
		});
		
		
	}
	
}
